#include <bits/stdc++.h>
using namespace std;

int p1, p2, p3;
string ans;

void unfold(char l, char r)
{
	string tmp;
	for(char c = l + 1;c < r;c ++)
	{
		int t = p2;
		while(t --)
		{
			if(p1 == 3) tmp += '*';
			else if(p1 == 2 && islower(l)) tmp += c - 32;
			else tmp += c;
		}
	}
	if(p3 == 2) reverse(tmp.begin(), tmp.end());
	ans += tmp;
}

int main()
{
	cin >> p1 >> p2 >> p3;
	string s; cin >> s;
	int n = s.size();
	for(int i = 0;i < n;i ++)
	{
		char ch = s[i];
		if(ch != '-' || i == 0 || i == n - 1) ans += ch;
		else
		{
			char l = s[i - 1], r = s[i + 1];
			if(((islower(l) && islower(r)) || (isdigit(l) && isdigit(r))) && r > l)
			{
				unfold(l, r);
			}
			else ans += ch;
		}
	}
	cout << ans << endl;
	return 0;
}